package com.drug.wms.service.impl;

import com.drug.common.utils.DateUtils;
import com.drug.wms.domain.BusGoodsPriceRelation;
import com.drug.wms.mapper.BusGoodsPriceRelationMapper;
import com.drug.wms.service.IBusGoodsPriceRelationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 商品-价格关联Service业务层处理
 *
 * @author ruoyi
 * @date 2021-11-09
 */
@Service
public class BusGoodsPriceRelationServiceImpl implements IBusGoodsPriceRelationService {
    @Autowired
    private BusGoodsPriceRelationMapper busGoodsPriceRelationMapper;

    /**
     * 查询商品-价格关联
     *
     * @param id 商品-价格关联主键
     * @return 商品-价格关联
     */
    @Override
    public BusGoodsPriceRelation selectBusGoodsPriceRelationById(String id) {
        return busGoodsPriceRelationMapper.selectBusGoodsPriceRelationById(id);
    }

    /**
     * 查询商品-价格关联列表
     *
     * @param busGoodsPriceRelation 商品-价格关联
     * @return 商品-价格关联
     */
    @Override
    public List<BusGoodsPriceRelation> selectBusGoodsPriceRelationList(BusGoodsPriceRelation busGoodsPriceRelation) {
        return busGoodsPriceRelationMapper.selectBusGoodsPriceRelationList(busGoodsPriceRelation);
    }

    /**
     * 新增商品-价格关联
     *
     * @param busGoodsPriceRelation 商品-价格关联
     * @return 结果
     */
    @Override
    public int insertBusGoodsPriceRelation(BusGoodsPriceRelation busGoodsPriceRelation) {
        busGoodsPriceRelation.setCreateTime(DateUtils.getNowDate());
        return busGoodsPriceRelationMapper.insertBusGoodsPriceRelation(busGoodsPriceRelation);
    }

    /**
     * 修改商品-价格关联
     *
     * @param busGoodsPriceRelation 商品-价格关联
     * @return 结果
     */
    @Override
    public int updateBusGoodsPriceRelation(BusGoodsPriceRelation busGoodsPriceRelation) {
        busGoodsPriceRelation.setUpdateTime(DateUtils.getNowDate());
        return busGoodsPriceRelationMapper.updateBusGoodsPriceRelation(busGoodsPriceRelation);
    }

    /**
     * 批量删除商品-价格关联
     *
     * @param ids 需要删除的商品-价格关联主键
     * @return 结果
     */
    @Override
    public int deleteBusGoodsPriceRelationByIds(String[] ids) {
        return busGoodsPriceRelationMapper.deleteBusGoodsPriceRelationByIds(ids);
    }

    /**
     * 删除商品-价格关联信息
     *
     * @param id 商品-价格关联主键
     * @return 结果
     */
    @Override
    public int deleteBusGoodsPriceRelationById(String id) {
        return busGoodsPriceRelationMapper.deleteBusGoodsPriceRelationById(id);
    }
}
